using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace ErlyThreads.Messages
{
    [Serializable]
    public class ThreadDied
    {
        Exception mReason = null;
        object mThreadId = null;

        public ThreadDied(
            object pId,
            Exception pReason)
        {
            mThreadId = pId;
            mReason = pReason;
        }

        public Exception Reason
        {
            get { return mReason; }
        }

        public string TextReason
        {
            get { return mReason.Message; }
        }

        public object Id
        {
            get { return mThreadId; }
        }

        public override string ToString()
        {
            return "Thread \"" + mThreadId.ToString() + "\" died: " + this.TextReason;
        }
    }

    [Serializable]
    public class ThreadStopped
    {
        object mThreadId = null;
        public object Id
        {
            get { return mThreadId; }
        }

        internal ThreadStopped(
            object pId)
        {
            mThreadId = pId;
        }

    }

    [Serializable]
    public class ThreadStarted
    {
        object mThreadId = null;
        public object Id
        {
            get { return mThreadId; }
        }

        internal ThreadStarted(
            object pThreadId)
        {
            mThreadId = pThreadId;
        }
    }
}
